// pages/CartGory/index.js
Page({
    data: {
      // 左侧菜单
      leftMenuList: [],
      // 右侧商品
      rightContent: [],
      //被点击的菜单
      currentIndex: 0
    },
    // 接口的返回值
    Cates: [],
    onLoad: function (options) {
      this.getCates();
    },
    getCates() {
      wx.request({
        url: 'http://460d80b632.zicp.vip/WeChat/sort.php',
        method: "POST",
        header: {
            "Content-Type": "application/x-www-form-urlencoded"
        },
        success: res => {
          this.Cates = res.data;
          let leftMenuList = this.Cates;
          let rightContent = this.Cates[0].smallsort;
          this.setData({
            leftMenuList,
            rightContent
          })
        },
      })
    },
    // 左侧菜单的点击
    handleItemTap(e) {
      const {
        index
      } = e.currentTarget.dataset;
      let rightContent = this.Cates[index].smallsort;
      this.setData({
        currentIndex: index,
        rightContent
      })
    }
  })